
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>在函数的第一条汇编指令打断点 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-back-to-top-button/plugin.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-chapter-fold/chapter-fold.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-code/plugin.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-search-pro/search.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-insert-logo/plugin.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="disassemble-next-line.html" />
    
    
    <link rel="prev" href="set-disassembly-flavor.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="./">
            
                <a href="./">
            
                    
                    信息显示
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1.1" data-path="show-version.html">
            
                <a href="show-version.html">
            
                    
                    显示gdb版本信息
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.1.2" data-path="show-copying-warranty.html">
            
                <a href="show-copying-warranty.html">
            
                    
                    显示gdb版权相关信息
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.1.3" data-path="start-gdb-silently.html">
            
                <a href="start-gdb-silently.html">
            
                    
                    启动时不显示提示信息
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.1.4" data-path="quit-gdb-silently.html">
            
                <a href="quit-gdb-silently.html">
            
                    
                    退出时不显示提示信息
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.1.5" data-path="set-pagination-off.html">
            
                <a href="set-pagination-off.html">
            
                    
                    输出信息多时不会暂停输出
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="./">
            
                <a href="./">
            
                    
                    函数
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="info-function.html">
            
                <a href="info-function.html">
            
                    
                    列出函数的名字
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="step-and-next-function.html">
            
                <a href="step-and-next-function.html">
            
                    
                    是否进入带调试信息的函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="set-step-mode-on.html">
            
                <a href="set-step-mode-on.html">
            
                    
                    进入不带调试信息的函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="finish-and-return.html">
            
                <a href="finish-and-return.html">
            
                    
                    退出正在调试的函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.5" data-path="call-func.html">
            
                <a href="call-func.html">
            
                    
                    直接执行函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.6" data-path="info-frame.html">
            
                <a href="info-frame.html">
            
                    
                    打印函数堆栈帧信息
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.7" data-path="set-debug-entry-values.html">
            
                <a href="set-debug-entry-values.html">
            
                    
                    打印尾调用堆栈帧信息
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.8" data-path="select-frame.html">
            
                <a href="select-frame.html">
            
                    
                    选择函数堆栈帧
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.9" data-path="up-down-select-frame.html">
            
                <a href="up-down-select-frame.html">
            
                    
                    向上或向下切换函数堆栈帧
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="divider"></li>
        
        
    
        <li class="chapter " data-level="2.1" data-path="./">
            
                <a href="./">
            
                    
                    观察点
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1.1" data-path="set-watchpoint.html">
            
                <a href="set-watchpoint.html">
            
                    
                    设置观察点
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.2" data-path="set-watchpoint-on-specified-thread.html">
            
                <a href="set-watchpoint-on-specified-thread.html">
            
                    
                    设置观察点只针对特定线程生效
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.3" data-path="set-read-watchpoint.html">
            
                <a href="set-read-watchpoint.html">
            
                    
                    设置读观察点
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.4" data-path="set-read-write-watchpoint.html">
            
                <a href="set-read-write-watchpoint.html">
            
                    
                    设置读写观察点
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="./">
            
                <a href="./">
            
                    
                    Catchpoint
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.2.1" data-path="tcatch.html">
            
                <a href="tcatch.html">
            
                    
                    让catchpoint只触发一次
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.2.2" data-path="catch-fork.html">
            
                <a href="catch-fork.html">
            
                    
                    为fork调用设置catchpoint
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.2.3" data-path="catch-vfork.html">
            
                <a href="catch-vfork.html">
            
                    
                    为vfork调用设置catchpoint
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.2.4" data-path="catch-exec.html">
            
                <a href="catch-exec.html">
            
                    
                    为exec调用设置catchpoint
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.2.5" data-path="catch-syscall.html">
            
                <a href="catch-syscall.html">
            
                    
                    为系统调用设置catchpoint
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.2.6" data-path="catch-ptrace.html">
            
                <a href="catch-ptrace.html">
            
                    
                    通过为ptrace调用设置catchpoint破解anti-debugging的程序
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="./">
            
                <a href="./">
            
                    
                    打印
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.3.1" data-path="print-ascii-and-wide-string.html">
            
                <a href="print-ascii-and-wide-string.html">
            
                    
                    打印ASCII和宽字符字符串
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.2" data-path="print-STL-container.html">
            
                <a href="print-STL-container.html">
            
                    
                    打印STL容器中的内容
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.3" data-path="print-large-array.html">
            
                <a href="print-large-array.html">
            
                    
                    打印大数组中的内容
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.4" data-path="print-consecutive-array-elements.html">
            
                <a href="print-consecutive-array-elements.html">
            
                    
                    打印数组中任意连续元素值
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.5" data-path="print-array-indexes.html">
            
                <a href="print-array-indexes.html">
            
                    
                    打印数组的索引下标
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.6" data-path="print-formatted-array.html">
            
                <a href="print-formatted-array.html">
            
                    
                    格式化打印数组
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.7" data-path="print-local-variables.html">
            
                <a href="print-local-variables.html">
            
                    
                    打印函数局部变量的值
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.8" data-path="print-process-memory.html">
            
                <a href="print-process-memory.html">
            
                    
                    打印进程内存信息
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.9" data-path="print-static-variables.html">
            
                <a href="print-static-variables.html">
            
                    
                    打印静态变量的值
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.10" data-path="print-variable-info.html">
            
                <a href="print-variable-info.html">
            
                    
                    打印变量的类型和所在文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.11" data-path="examine-memory.html">
            
                <a href="examine-memory.html">
            
                    
                    打印内存的值
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.12" data-path="print-source-lines.html">
            
                <a href="print-source-lines.html">
            
                    
                    打印源代码行
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.13" data-path="set-print-pretty-on.html">
            
                <a href="set-print-pretty-on.html">
            
                    
                    每行打印一个结构体成员
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.14" data-path="print-derived-type.html">
            
                <a href="print-derived-type.html">
            
                    
                    按照派生类型打印对象
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.15" data-path="set-io-tty.html">
            
                <a href="set-io-tty.html">
            
                    
                    指定程序的输入输出设备
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.16" data-path="use-$_-$__-variables.html">
            
                <a href="use-$_-$__-variables.html">
            
                    
                    使用“$\”和“$\_”变量
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.17" data-path="print-malloc-memory.html">
            
                <a href="print-malloc-memory.html">
            
                    
                    打印程序动态分配内存的信息
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.18" data-path="print-frame-variables.html">
            
                <a href="print-frame-variables.html">
            
                    
                    打印调用栈帧中变量的值
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.4" data-path="./">
            
                <a href="./">
            
                    
                    多进程/线程
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.4.1" data-path="attach-process.html">
            
                <a href="attach-process.html">
            
                    
                    调试已经运行的进程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.4.2" data-path="set-follow-fork-mode-child.html">
            
                <a href="set-follow-fork-mode-child.html">
            
                    
                    调试子进程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.4.3" data-path="set-detach-on-fork.html">
            
                <a href="set-detach-on-fork.html">
            
                    
                    同时调试父进程和子进程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.4.4" data-path="print-threads.html">
            
                <a href="print-threads.html">
            
                    
                    查看线程信息
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.4.5" data-path="print-all-threads-bt.html">
            
                <a href="print-all-threads-bt.html">
            
                    
                    打印所有线程的堆栈信息
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.4.6" data-path="maint-info-sol-threads.html">
            
                <a href="maint-info-sol-threads.html">
            
                    
                    在Solaris上使用maintenance命令查看线程信息
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.4.7" data-path="show-print-thread-events.html">
            
                <a href="show-print-thread-events.html">
            
                    
                    不显示线程启动和退出信息
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.4.8" data-path="set-scheduler-locking-on.html">
            
                <a href="set-scheduler-locking-on.html">
            
                    
                    只允许一个线程运行
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.4.9" data-path="use-$_thread-variable.html">
            
                <a href="use-$_thread-variable.html">
            
                    
                    使用“$_thread”变量
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.4.10" data-path="add-copy-inferiors.html">
            
                <a href="add-copy-inferiors.html">
            
                    
                    一个gdb会话中同时调试多个程序
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.4.11" data-path="maint-info-program-space.html">
            
                <a href="maint-info-program-space.html">
            
                    
                    打印程序进程空间信息
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.4.12" data-path="use-$_exitcode.html">
            
                <a href="use-$_exitcode.html">
            
                    
                    使用“$_exitcode”变量
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.5" data-path="./">
            
                <a href="./">
            
                    
                    函数
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.5.1" data-path="generate-core-dump-file.html">
            
                <a href="generate-core-dump-file.html">
            
                    
                    为调试进程产生core dump文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.5.2" data-path="load-executable-and-coredump-file.html">
            
                <a href="load-executable-and-coredump-file.html">
            
                    
                    加载可执行程序和core dump文件
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.6" data-path="./">
            
                <a href="./">
            
                    
                    汇编
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.6.1" data-path="set-disassembly-flavor.html">
            
                <a href="set-disassembly-flavor.html">
            
                    
                    设置汇编指令格式
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="2.6.2" data-path="break-on-first-assembly-code.html">
            
                <a href="break-on-first-assembly-code.html">
            
                    
                    在函数的第一条汇编指令打断点
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6.3" data-path="disassemble-next-line.html">
            
                <a href="disassemble-next-line.html">
            
                    
                    自动反汇编后面要执行的代码
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6.4" data-path="map-source-code-and-assembly.html">
            
                <a href="map-source-code-and-assembly.html">
            
                    
                    将源程序和汇编指令映射起来
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6.5" data-path="display-instruction-pc.html">
            
                <a href="display-instruction-pc.html">
            
                    
                    显示将要执行的汇编指令
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6.6" data-path="print-registers.html">
            
                <a href="print-registers.html">
            
                    
                    打印寄存器的值
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6.7" data-path="disassemble-raw-machine-code.html">
            
                <a href="disassemble-raw-machine-code.html">
            
                    
                    显示程序原始机器码
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.7" data-path="./">
            
                <a href="./">
            
                    
                    函数
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.7.1" data-path="change-string.html">
            
                <a href="change-string.html">
            
                    
                    改变字符串的值
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.7.2" data-path="set-var.html">
            
                <a href="set-var.html">
            
                    
                    设置变量的值
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.7.3" data-path="modify-pc-register.html">
            
                <a href="modify-pc-register.html">
            
                    
                    修改PC寄存器的值
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.7.4" data-path="jump.html">
            
                <a href="jump.html">
            
                    
                    跳转到指定位置执行
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.7.5" data-path="breakpoint-command.html">
            
                <a href="breakpoint-command.html">
            
                    
                    使用断点命令改变程序的执行
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.7.6" data-path="patch-program.html">
            
                <a href="patch-program.html">
            
                    
                    修改被调试程序的二进制文件
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.8" data-path="./">
            
                <a href="./">
            
                    
                    信号
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.8.1" data-path="info-signals.html">
            
                <a href="info-signals.html">
            
                    
                    查看信号处理信息
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.8.2" data-path="stop-signal.html">
            
                <a href="stop-signal.html">
            
                    
                    信号发生时是否暂停程序
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.8.3" data-path="print-signal.html">
            
                <a href="print-signal.html">
            
                    
                    信号发生时是否打印信号信息
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.8.4" data-path="pass-signal.html">
            
                <a href="pass-signal.html">
            
                    
                    信号发生时是否把信号丢给程序处理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.8.5" data-path="send-signal.html">
            
                <a href="send-signal.html">
            
                    
                    给程序发送信号
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.8.6" data-path="use-$_siginfo-variable.html">
            
                <a href="use-$_siginfo-variable.html">
            
                    
                    使用“$_siginfo”变量
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.9" data-path="./">
            
                <a href="./">
            
                    
                    共享库
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.9.1" data-path="info_sharedlibrary.html">
            
                <a href="info_sharedlibrary.html">
            
                    
                    显示共享链接库信息
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.10" data-path="./">
            
                <a href="./">
            
                    
                    脚本
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.10.1" data-path="config-gdbinit.html">
            
                <a href="config-gdbinit.html">
            
                    
                    配置gdb init文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.10.2" data-path="set-script-extension.html">
            
                <a href="set-script-extension.html">
            
                    
                    按何种方式解析脚本文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.10.3" data-path="save-history-commands.html">
            
                <a href="save-history-commands.html">
            
                    
                    保存历史命令
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.11" data-path="./">
            
                <a href="./">
            
                    
                    源文件
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.11.1" data-path="directory.html">
            
                <a href="directory.html">
            
                    
                    设置源文件查找路径
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.11.2" data-path="substitute-path.html">
            
                <a href="substitute-path.html">
            
                    
                    替换查找源文件的目录
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.12" data-path="./">
            
                <a href="./">
            
                    
                    图形化界面
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.12.1" data-path="tui-mode.html">
            
                <a href="tui-mode.html">
            
                    
                    进入和退出图形化调试界面
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.12.2" data-path="layout-asm.html">
            
                <a href="layout-asm.html">
            
                    
                    显示汇编代码窗口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.12.3" data-path="layout-regs.html">
            
                <a href="layout-regs.html">
            
                    
                    显示寄存器窗口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.12.4" data-path="winheight.html">
            
                <a href="winheight.html">
            
                    
                    调整窗口大小
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.13" data-path="./">
            
                <a href="./">
            
                    
                    其它
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.13.1" data-path="option-format.html">
            
                <a href="option-format.html">
            
                    
                    命令行选项的格式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.13.2" data-path="preprocessor-macro.html">
            
                <a href="preprocessor-macro.html">
            
                    
                    支持预处理器宏信息
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.13.3" data-path="keep-unused-types.html">
            
                <a href="keep-unused-types.html">
            
                    
                    保留未使用的类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.13.4" data-path="use-short-command.html">
            
                <a href="use-short-command.html">
            
                    
                    使用命令的缩写形式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.13.5" data-path="run-shell-command.html">
            
                <a href="run-shell-command.html">
            
                    
                    在gdb中执行shell命令和make
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.13.6" data-path="run-cd-pwd.html">
            
                <a href="run-cd-pwd.html">
            
                    
                    在gdb中执行cd和pwd命令
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.13.7" data-path="set-prompt.html">
            
                <a href="set-prompt.html">
            
                    
                    设置命令提示符
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.13.8" data-path="set-program-args.html">
            
                <a href="set-program-args.html">
            
                    
                    设置被调试程序的参数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.13.9" data-path="set-program-env.html">
            
                <a href="set-program-env.html">
            
                    
                    设置被调试程序的环境变量
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.13.10" data-path="help.html">
            
                <a href="help.html">
            
                    
                    得到命令的帮助信息
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.13.11" data-path="set-logging.html">
            
                <a href="set-logging.html">
            
                    
                    记录执行gdb的过程
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="." >在函数的第一条汇编指令打断点</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="&#x5728;&#x51FD;&#x6570;&#x7684;&#x7B2C;&#x4E00;&#x6761;&#x6C47;&#x7F16;&#x6307;&#x4EE4;&#x6253;&#x65AD;&#x70B9;">&#x5728;&#x51FD;&#x6570;&#x7684;&#x7B2C;&#x4E00;&#x6761;&#x6C47;&#x7F16;&#x6307;&#x4EE4;&#x6253;&#x65AD;&#x70B9;</h1>
<h2 id="&#x4F8B;&#x5B50;">&#x4F8B;&#x5B50;</h2>
<pre><code>#include &lt;stdio.h&gt;
int global_var;

void change_var(){
    global_var=100;
}

int main(void){
    change_var();
    return 0;
}
</code></pre><h2 id="&#x6280;&#x5DE7;">&#x6280;&#x5DE7;</h2>
<p>&#x901A;&#x5E38;&#x7ED9;&#x51FD;&#x6570;&#x6253;&#x65AD;&#x70B9;&#x7684;&#x547D;&#x4EE4;&#xFF1A;&#x201C;b func&#x201D;&#xFF08;b&#x662F;break&#x547D;&#x4EE4;&#x7684;&#x7F29;&#x5199;&#xFF09;&#xFF0C;&#x4E0D;&#x4F1A;&#x628A;&#x65AD;&#x70B9;&#x8BBE;&#x7F6E;&#x5728;&#x6C47;&#x7F16;&#x6307;&#x4EE4;&#x5C42;&#x6B21;&#x51FD;&#x6570;&#x7684;&#x5F00;&#x5934;&#xFF0C;&#x4F8B;&#x5982;&#xFF1A;</p>
<pre><code>(gdb) b main
Breakpoint 1 at 0x8050c12: file a.c, line 9.
(gdb) r
Starting program: /data1/nan/a
[Thread debugging using libthread_db enabled]
[New Thread 1 (LWP 1)]
[Switching to Thread 1 (LWP 1)]

Breakpoint 1, main () at a.c:9
9           change_var();
(gdb) disassemble
Dump of assembler code for function main:
   0x08050c0f &lt;+0&gt;:     push   %ebp
   0x08050c10 &lt;+1&gt;:     mov    %esp,%ebp
=&gt; 0x08050c12 &lt;+3&gt;:     call   0x8050c00 &lt;change_var&gt;
   0x08050c17 &lt;+8&gt;:     mov    $0x0,%eax
   0x08050c1c &lt;+13&gt;:    pop    %ebp
   0x08050c1d &lt;+14&gt;:    ret
End of assembler dump.
</code></pre><p>&#x53EF;&#x4EE5;&#x770B;&#x5230;&#x7A0B;&#x5E8F;&#x505C;&#x5728;&#x4E86;&#x7B2C;&#x4E09;&#x6761;&#x6C47;&#x7F16;&#x6307;&#x4EE4;&#xFF08;&#x7BAD;&#x5934;&#x6240;&#x6307;&#x4F4D;&#x7F6E;&#xFF09;&#x3002;&#x5982;&#x679C;&#x8981;&#x628A;&#x65AD;&#x70B9;&#x8BBE;&#x7F6E;&#x5728;&#x6C47;&#x7F16;&#x6307;&#x4EE4;&#x5C42;&#x6B21;&#x51FD;&#x6570;&#x7684;&#x5F00;&#x5934;&#xFF0C;&#x8981;&#x4F7F;&#x7528;&#x5982;&#x4E0B;&#x547D;&#x4EE4;&#xFF1A;&#x201C;b *func&#x201D;&#xFF0C;&#x4F8B;&#x5982;&#xFF1A;</p>
<pre><code>(gdb) b *main
Breakpoint 1 at 0x8050c0f: file a.c, line 8.
(gdb) r
Starting program: /data1/nan/a
[Thread debugging using libthread_db enabled]
[New Thread 1 (LWP 1)]
[Switching to Thread 1 (LWP 1)]

Breakpoint 1, main () at a.c:8
8       int main(void){
(gdb) disassemble
Dump of assembler code for function main:
=&gt; 0x08050c0f &lt;+0&gt;:     push   %ebp
   0x08050c10 &lt;+1&gt;:     mov    %esp,%ebp
   0x08050c12 &lt;+3&gt;:     call   0x8050c00 &lt;change_var&gt;
   0x08050c17 &lt;+8&gt;:     mov    $0x0,%eax
   0x08050c1c &lt;+13&gt;:    pop    %ebp
   0x08050c1d &lt;+14&gt;:    ret
End of assembler dump.
</code></pre><p>&#x53EF;&#x4EE5;&#x770B;&#x5230;&#x7A0B;&#x5E8F;&#x505C;&#x5728;&#x4E86;&#x7B2C;&#x4E00;&#x6761;&#x6C47;&#x7F16;&#x6307;&#x4EE4;&#xFF08;&#x7BAD;&#x5934;&#x6240;&#x6307;&#x4F4D;&#x7F6E;&#xFF09;&#x3002;</p>
<h2 id="&#x8D21;&#x732E;&#x8005;">&#x8D21;&#x732E;&#x8005;</h2>
<p>nanxiao</p>
<footer class="page-footer"><span class="copyright">powered by Gitbook</span><span class="footer-modification">&#x8BE5;&#x6587;&#x7AE0;&#x4FEE;&#x8BA2;&#x65F6;&#x95F4;&#xFF1A;
2021-01-18 12:59:02
</span></footer>
<script>console.log("plugin-popup....");document.onclick = function(e){ e.target.tagName === "IMG" && window.open(e.target.src,e.target.src)}</script><style>img{cursor:pointer}</style>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="set-disassembly-flavor.html" class="navigation navigation-prev " aria-label="Previous page: 设置汇编指令格式">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="disassemble-next-line.html" class="navigation navigation-next " aria-label="Next page: 自动反汇编后面要执行的代码">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"在函数的第一条汇编指令打断点","level":"2.6.2","depth":2,"next":{"title":"自动反汇编后面要执行的代码","level":"2.6.3","depth":2,"path":"disassemble-next-line.md","ref":"disassemble-next-line.md","articles":[]},"previous":{"title":"设置汇编指令格式","level":"2.6.1","depth":2,"path":"set-disassembly-flavor.md","ref":"set-disassembly-flavor.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":["back-to-top-button","chapter-fold","hide-element","code","splitter","-lunr","-search","search-pro","insert-logo","tbfed-pagefooter","popup","livereload"],"pluginsConfig":{"tbfed-pagefooter":{"copyright":"","modify_label":"该文章修订时间：","modify_format":"YYYY-MM-DD HH:mm:ss"},"chapter-fold":{},"livereload":{},"splitter":{},"search-pro":{},"popup":{},"code":{"copyButtons":true},"hide-element":{"elements":[".gitbook-link"]},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"back-to-top-button":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"insert-logo":{"style":"background: none; max-height: 30px; min-height: 30px","url":"https://www.sourceware.org/gdb/images/archer.svg"}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"break-on-first-assembly-code.md","mtime":"2021-01-18T04:59:02.000Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2022-06-14T12:11:51.367Z"},"basePath":".","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="gitbook/gitbook.js"></script>
    <script src="gitbook/theme.js"></script>
    
        
        <script src="gitbook/gitbook-plugin-back-to-top-button/plugin.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-chapter-fold/chapter-fold.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-hide-element/plugin.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-code/plugin.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-search-pro/jquery.mark.min.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-search-pro/search.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-insert-logo/plugin.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

